package com.yuque.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yuque.pojo.article;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface ArticleDao extends BaseMapper<article> {
    @Select(" SELECT COUNT(*)\n" +
            "            FROM   article,category\n" +
            "            WHERE category.`id`=article.`category_id` AND article.`create_user`=#{createUser}")
    int cha(Map map);
    @Select(" SELECT article.id, title,content,article.`create_time`,category_name,state FROM article,category WHERE " +
            "category.`id`=article.`category_id` AND article.`create_user`=#{createUser} and article.deleted=0 LIMIT #{pageNo},#{pageSize}")
    List<Map> chaxun(Map map);
    @Select(" SELECT article.`category_id`, cover_img,title,content,article.`create_time`,category_name,state FROM article,category WHERE \n" +
            "            category.`id`=article.`category_id` AND article.id=#{id}")
    Map chaid(Integer id);
}
